local groundTiles = {}
local size = 5

function createGround(width, height)
	for y = 0, height-1, 1 do
		for x = 0, width-1, 1 do
			local n = y * width + x
			groundTiles[n] = Plane(Vector3(x * size, 0, y * size), Vector3(size, 0, -size))
			if(n == 0) then
				groundTiles[n].texture = "game\\images\\ground_plate01_bl.png"
			elseif(x == width - 1) then
				if(y == 0) then
					groundTiles[n].texture = "game\\images\\ground_plate01_br.png"
					print(n)
				elseif(y == height - 1) then
					groundTiles[n].texture = "game\\images\\ground_plate01_tr.png"
					print(n)
				else
					groundTiles[n].texture = "game\\images\\ground_plate01_r.png"
				end
			elseif(x == 0) then
				if(y == height - 1) then
					groundTiles[n].texture = "game\\images\\ground_plate01_tl.png"
					print(n)
				else
					groundTiles[n].texture = "game\\images\\ground_plate01_r.png"
				end
			elseif(y == height - 1) then
				groundTiles[n].texture = "game\\images\\ground_plate01_b.png"
			elseif(y == 0) then
				groundTiles[n].texture = "game\\images\\ground_plate01_b.png"
			else
				groundTiles[n].texture = "game\\images\\ground_plate01.png"
			end
		end
	end
end


function renderGround()
	for i, tile in pairs(groundTiles) do
		tile:render()
	end
end